Trapdoor
Trapdoors are the second type of entry-barring block added to Minecraft after the door. While normal doors prevent horizontal barriers from being crossed, Trapdoors instead bar a single block of verticle travel. They require an adjacent solid block to be placed upon, and will be hinged to that block when opened. There is only a single trapdoor in the vanilla game, aptly titled "Trap Door". Because trapdoors used their metadata for facing and opened/closed status, it is not possible to make variants using damage values. Example Trap Door (CS2 0.9.10 and above) mod.js config.addBlockIdProperty("cobaltTrapdoorID", 2523); mod.addBlock("cobaltTrapDoor.js", "trapDoor"); blocks/cobaltTrapDoor.js id = config.getBlockId("cobaltTrapdoorID"); name = "cobaltTrapdoor"; material = "iron"; stepSound = "metal"; creativeTab = "buildingBlocks"; redstoneOnly = false; displayName0 = "Cobalt Trapdoor"; hardness0 = 5; resistance0 = 30; toolClass0 = "pickaxe"; harvestLevel0 = 2; textureFileXP0 = "cobaltTrapDoor.png"; textureFileXN0 = "cobaltTrapDoor.png"; textureFileYP0 = "cobaltTrapDoor.png"; textureFileYN0 = "cobaltTrapDoor.png"; textureFileZP0 = "cobaltTrapDoor.png"; textureFileZN0 = "cobaltTrapDoor.png"; addToCreative0 = true; Trap Door Block Attributes Required Attributes * displayName * id * name * textureFileXN * textureFileXP * textureFileYN * textureFileYP * textureFileZN * textureFileZP Optional Attributes * addToCreative * canPlaceOnCeiling * canPlaceOnFloor * canPlaceOnWall * canSilkHarvest * creativeTab * drop * fireSpreadSpeed * flammability * fortuneModifier * hardness * harvestLevel * hasCollision * hasTileEntity * isBeaconBase * isBurning * isFireSource * isWood * light * material * opacity * pick * redstoneOnly * resistance * semiTransparent * slipperiness * stepSound * tickrate * tileEntity * tileTransparent * toolClass * transparent textureFile and textureIndex In CS2 versions for 1.4.7 and below, CS2 0.9.9 or below, textureFile was used to specify the texture sheet and textureIndex was used for identifying the specific icon within the texture sheet. If using CS2 0.9.9 or lower, make sure to use both of these attributes. redstoneOnly This determines if the trap door can be opened by hand or only by a redstone signal. If set to false, the trap door can be opened by hand or by redstone signal. If set to true, it can only be opened using a redstone signal. Example Trap Door Block (CS2) This is an example of a custom trapdoor. In particular, this will give you the iron trapdoor shown on the image above. Like all blocks, it should be saved with the extension .block under '/config/customBlocks' name="Iron Trap Door"; id=225; texturefile="terrain.png"; textureindex=22; type="trapdoor"; material="iron"; stepsound="metal"; hardness=5; resistance=25; iddropped=225; opacity=0; redstoneonly="true"; toolclass="pickaxe"; harvestlevel=0; Trap Door Attributes (CS1) Below is a table of attributes available to the door type block, including information on notable attributes. Required Attributes * name * id * type * texturefile * textureindex * opacity * toolclass * harvestlevel Optional Attributes * material * stepsound * redstoneonly * hardness * resistance * light * iddropped * quantitydropped * damagedropped * transparent * collision * addtocreative * color * container * maxstack type This must be set to 'trapdoor' in order for the block to function as a trap door. redstoneonly This attribute is used only on doors, fence gates and trapdoors. When set to true, this attribute prevents the door from being opened normally, requiring a redstone current to toggle the position of the door. In vanilla Minecraft, iron doors have this attribute set as true while wooden doors have it set as false. opacity Setting this attribute to a low value prevents a rather pronounced visual bug. See Importance of the Opacity Attribute below. Importance of the Opacity Attribute When making trapdoordoor blocks the opacity attribute should always be set to a value of ten or less even if the the material being used not being intrinsically translucent. This is done to prevent a visual 'bug', demonstrated by the picture at right, which causes a shadow is cast on the faces adjacent to the trapdoor regardless of light level. This 'glitch' occurs because Minecraft calculates the light level of the area 'inside' the block based on what's immediately below it. Because a block normally blocks all light, the boundary of the stairs block (the box you see when you place your reticule on it) forces the game to calculate the light level as being 0 on the ground beneath the block. Setting the opacity to a low value fixes this issue. This is also why stairs, slabs, and doors in the vanilla game don't block light entirely even when they logically should. Category:Block Types Category:Examples Category:Custom Stuff 2 Category:Examples (CS1)